<!DOCTYPE html>
<html>
<head>
    <block name="include">
        <include file="Public:header"/>
    </block>
</head>
<body>
<br>
<div class="layui-container">
    <div class="layui-row">
        <div class="layui-col-sm9 LAY_preview">
            <form class="layui-form layui-form-pane">
                <input type="hidden" name="id" required class="layui-input" value="{$data.id}">
                <div class="layui-form-item">
                    <label class="layui-form-label ">公司名:</label>
                    <div class="layui-input-block">
                        <input type="text" name="name" required lay-verify="required" placeholder="公司名"
                               autocomplete="off" class="layui-input" value="{$data.name}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">法人:</label>
                    <div class="layui-input-block">
                        <input type="text" name="boss" placeholder="法人"
                               autocomplete="off" class="layui-input" value="{$data.boss}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">创建时间:</label>
                    <div class="layui-input-block">
                        <input type="text" name="create_date" placeholder="创建时间" class="layui-input" id="create_date" value="{$data.create_date|substr=0,10}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">注册资金:</label>
                    <div class="layui-input-block">
                        <input type="text" name="basement"
                               autocomplete="off" class="layui-input" placeholder="注册资金" value="{$data.basement}">
                    </div>
                </div>
                <div class="layui-form-item">

                    <label class="layui-form-label">地址:</label>
                    <div class="layui-input-block">
                        <input type="text" name="address"
                               autocomplete="off" class="layui-input" value="{$data.address}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">经营范围:</label>
                    <div class="layui-input-block">
                        <textarea name="span" placeholder="经营范围" class="layui-textarea">{$data.span}</textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="formEdit">立即提交</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<block name="include">
    <include file="Public:footer"/>
</block>
<script>
    layui.use('form', function () {
        var form = layui.form;

        form.on('submit(formEdit)', function(data){
            layui.use(['jquery', 'layer'], function () {
                var $ = layui.$
                    , layer = layui.layer;
                console.log(data.field);
                $.ajax({
                    url: "{:U('Span/editPost')}",
                    data: data.field,
                    dataType: 'json',
                    type: 'post',
                    success: function (data) {
                        if(data.status == 1){
                            parent.location.href="{:U('Span/index')}";
                        }else{
                            layer.msg(data.info);
                        }
                    }
                });
            });
            return false;
        });
    });

    layui.use('laydate', function(){
        var laydate = layui.laydate;
        laydate.render({
            elem: '#create_date',
            type: 'date'
        });
    });
</script>
</body>
</html>